{% extends "base.html" %}

{% block title %}
    用户列表
{% endblock %}

{% block content %}
    <div>
        <div class="btn-group">
            {% url "adduserurl" as theadduserurl %}
            <a class="btn btn-default {%if request.path == theadduserurl%} active {%endif%}" href={{ theadduserurl }}><span class="glyphicon glyphicon-edit"></span>新建用户</a>
            {% url "listuserurl" as thelistuserurl %}
            <a class="btn btn-default {%if request.path == thelistuserurl%} active {%endif%}" href={{ thelistuserurl }}><span class="glyphicon glyphicon-list"></span>用户列表</a>
        </div>
    </div>

    <hr/>

    <table class="result-tab" width="100%">
        <tr>
            <th class="tc" width="5%"></th>
            <th>ID</th>
            <th>账号</th>
            <th>邮箱</th>
            <th>姓名</th>
            <th>部门[组]</th>
            <th>状态</th>
            <th>上次登录</th>
            <th>操作</th>
        </tr>

        {% for foo in lpage %}
        <tr>
            <td class="tc">
                <input type="checkbox" value="" name="id[]">
            </td>
            <td>{{ foo.id }}</td>
            <td>{{ foo.username }}</td>
            <td>{{ foo.email }}</td>
            <td>{{ foo.fullname }}</td>
            <td>{{ foo.role_id }}</td>
            <td>
                {% if foo.is_active %}
                    <span class="label label-success">启用</span>
                {% else %}
                    <span class="label label-default">禁用</span>
                {% endif %}
            </td>
            <td>{{ foo.last_login }}</td>
            <td class="host_buttom">
                <a class="btn btn-warning btn-xs" href={% url "edituserurl" foo.id %} onclick="return confirm('是否确认编辑？')">编辑</a>
                <a class="btn btn-danger btn-xs" href={% url "deleteuserurl" foo.id %} onclick="return confirm('是否确认删除？')">删除</a>
            </td>
        </tr>
        {% endfor %}


    </table>
    {% include "paginator.html" %}
{% endblock %}
